package com.meteor.framework.common.base;

import com.alibaba.excel.util.StringUtils;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fhs.core.trans.vo.TransPojo;
import com.meteor.framework.common.utils.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema;

import java.text.ParseException;
import java.util.Date;

@Schema
public class BaseEntity<T extends Model> extends Model  implements TransPojo {

    private String id;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", hidden = true, readOnly = true)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", hidden = true, readOnly = true)
    private Date updateTime;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建者", hidden = true, readOnly = true)
    private String createdBy;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新者", hidden = true, readOnly = true)
    private String updatedBy;

    @Schema(description = "状态", hidden = true, readOnly = true)
    private Integer status = 1;

    @Schema(description = "商户id", hidden = true, readOnly = true)
    private String merchantId;


    @Version
    @Schema(description = "版本号", hidden = true, readOnly = true)
    @TableField(fill = FieldFill.INSERT)
    private Integer version;

    @TableLogic
    @Schema(description = "删除标记", hidden = true, readOnly = true)
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    public Date getCreateTime() {
        if (this.createTime==null){
            return null;
        }
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {

        if (createTime!=null){
            this.createTime = createTime;
        }

    }

    public Date getUpdateTime() {
        if (this.updateTime==null){
            return null;
        }
        return this.updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        if(updateTime!=null) {
            this.updateTime = updateTime;
        }
    }

    public String getUpdatedBy() {

        return this.updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public String getCreatedBy() {
        return this.createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

}

